<?php require_once('Connections/local.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_local, $local);
$query_Events = "SELECT * FROM events ORDER BY e_time ASC";
$Events = mysql_query($query_Events, $local) or die(mysql_error());
$row_Events = mysql_fetch_assoc($Events);
$totalRows_Events = mysql_num_rows($Events);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>

<link href="css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
a {
	font-family: "微軟正黑體", "細明體";
	font-size: 16px;
	color: #333;
	font-weight: bold;
}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
	color: #06F;
}
a:active {
	text-decoration: none;
}
</style>
<script type="text/javascript">
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
</script>
</head>

<body>
<br />
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" class="title01">訂票系統</td>
  </tr>
</table>
<p>&nbsp;</p>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="542">&nbsp;</td>
    <td width="458" align="right" class="text"><a href="login.php">請登入</a></td>
  </tr>
</table>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr class="text">
    <td width="212" align="center" valign="middle">活動時間</td>
    <td width="670" align="left" valign="middle">活動名稱</td>
    <td width="118" align="center" valign="middle">剩餘座位</td>
  </tr>
  <?php do { ?>
    <tr>
      <td align="center" valign="middle" class="date"><?php echo $row_Events['e_time']; ?></td>
      <td align="left" valign="middle"><a href="event_details.php?eid=<?php echo $row_Events['eid'];   ?>"><?php echo $row_Events['e_name']; ?></a></td>
      <td align="center" valign="middle" class="seats"><?php echo $row_Events['seats']; ?></td>
    </tr>
    <?php } while ($row_Events = mysql_fetch_assoc($Events)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Events);
?>
